package base.service.dao.base.model.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;

import com.ibatis.sqlmap.client.SqlMapClient;

import base.service.dao.BaseDao;
import base.service.dao.base.model.IDaoBaseModel;
import base.service.domain.exception.DaoException;

/**
* @Title: DaoBaseModelImpl.java
* @Package base.service.dao.base.model.impl
* @Description: TODO
* @author YeQing  
* @date 2012-6-10 下午02:05:30
* @version V1.0
 */
public class DaoBaseModelImpl extends BaseDao implements IDaoBaseModel{

	protected Logger log = Logger.getLogger(this.getClass());
	
	public DaoBaseModelImpl(SqlMapClient sqlMap) {
		super(sqlMap);
	}
	
	public List getListBaseModel(Map paramMap) throws DaoException {
        List list = null;
		try {

			list =  sqlMap.queryForList("base.model.getListBASE_MODEL", paramMap);
		} catch (SQLException e) {
			String err = "Get BaseMenuItem Error.";
			log.error(err, e);
            e.printStackTrace();
			throw new DaoException(err, e);
		}
        return list;
	}



    public int getListBaseModelCount(Map paramMap) throws DaoException {
        int count = 0;
        try {
			count = Integer.valueOf(sqlMap.queryForObject("base.model.getListBASE_MODELCount", paramMap).toString());
		} catch (SQLException e) {
			String err = "Get BaseMenuItemCount Error";
			log.error(err, e);
            throw new DaoException(err, e);

		}
        return count;
    }

    public void insertBaseModel(Map paramMap) throws DaoException {
        try {
            sqlMap.insert("base.model.insertBASE_MODEL", paramMap);
        } catch (SQLException e) {
            String err = "Insert BaseModel Error.";
			log.error(err, e);
            throw new DaoException(err, e);
        }
    }

    public int update(Map paramMap) throws DaoException {
        try {
            return sqlMap.update("base.model.updateBase_model", paramMap);
        } catch (SQLException e) {
            String err = "Update BaseModel Error.";
			log.error(err, e);
            throw new DaoException(err, e);
        }
    }

}
